package cz.muni.fi.pb138.accountingRecords;

/**
 * Class representing person or company, default getters and setters
 * @author Michal
 */
public class Subject {

    private String subjectName;//name of company or firstname and surname of person
    //Address
    private String city;
    private String street;// --IMPLIED
    private Integer number;//number of building
    private Integer postalCode;
    private String phone;// --IMPLIED
    private String mail;// --IMPLIED
    private Integer idNumber;//Identification Number of company --IMPLIED

    /**
     * Returns city from address
     * @return city from address
     */
    public String getCity() {
        return city;
    }

    /**
     * sets city from address
     * @param city city from address
     */
    public void setCity(String city) {
        this.city = city;
    }

    /**
     * returns ID number of company
     * @return ID number of company
     */
    public Integer getIdNumber() {
        return idNumber;
    }

    /**
     * sets ID number of company
     * @param idNumber ID number of company
     */
    public void setIdNumber(Integer idNumber) {
        this.idNumber = idNumber;
    }

    /**
     * returns e-mail address of subject
     * @return e-mail address of subject
     */
    public String getMail() {
        return mail;
    }

    /**
     * sets e-mail address of subject
     * @param mail e-mail address of subject
     */
    public void setMail(String mail) {
        this.mail = mail;
    }

    /**
     * returns number of building from address
     * @return number of building from address
     */
    public Integer getNumber() {
        return number;
    }

    /**
     * sets number of building from address
     * @param number number of building from address
     */
    public void setNumber(Integer number) {
        this.number = number;
    }

    /**
     * returns phone number of subject
     * @return phone number of subject
     */
    public String getPhone() {
        return phone;
    }

    /**
     * sets phone number of subject
     * @param phone phone number of subject
     */
    public void setPhone(String phone) {
        this.phone = phone;
    }

    /**
     * returns postal code from address
     * @return postal code from address
     */
    public Integer getPostalCode() {
        return postalCode;
    }

    /**
     * sets postal code from address
     * @param postalCode postal code from address
     */
    public void setPostalCode(Integer postalCode) {
        this.postalCode = postalCode;
    }

    /**
     * returns street from address
     * @return street from address
     */
    public String getStreet() {
        return street;
    }

    /**
     * sets street from address
     * @param street street from address
     */
    public void setStreet(String street) {
        this.street = street;
    }

    /**
     * returns name of subject, it can be full name of person or name of campany
     * @return name of subject
     */
    public String getSubjectName() {
        return subjectName;
    }

    /**
     * sets name of subject, it can be full name of person or name of campany
     * @param subjectName name of subject
     */
    public void setSubjectName(String subjectName) {
        this.subjectName = subjectName;
    }

    /**
     * compares two subjects, they are same if they have same name and full address
     * @param obj subject that will be compared
     * @return true if two subjects are same
     */
    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Subject other = (Subject) obj;
        if ((this.subjectName == null) ? (other.subjectName != null) : !this.subjectName.equals(other.subjectName)) {
            return false;
        }
        if ((this.city == null) ? (other.city != null) : !this.city.equals(other.city)) {
            return false;
        }
        if ((this.street == null) ? (other.street != null) : !this.street.equals(other.street)) {
            return false;
        }
        if (this.number != other.number && (this.number == null || !this.number.equals(other.number))) {
            return false;
        }
        if (this.postalCode != other.postalCode && (this.postalCode == null || !this.postalCode.equals(other.postalCode))) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 5;
        hash = 37 * hash + (this.subjectName != null ? this.subjectName.hashCode() : 0);
        hash = 37 * hash + (this.city != null ? this.city.hashCode() : 0);
        hash = 37 * hash + (this.street != null ? this.street.hashCode() : 0);
        hash = 37 * hash + (this.number != null ? this.number.hashCode() : 0);
        hash = 37 * hash + (this.postalCode != null ? this.postalCode.hashCode() : 0);
        return hash;
    }

    

    @Override
    public String toString() {
        return "Subject{" + "subjectName=" + subjectName + "city=" + city + "street=" + street + "number=" + number + "postalCode=" + postalCode + "phone=" + phone + "mail=" + mail + "idNumber=" + idNumber + '}';
    }

}
